/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 1.0.4</a>, using an XML
 * Schema.
 * $Id$
 */

package com.jzhao.jpre.format.sequential.castor;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
 * Class RecordType.
 * 
 * @version $Revision$ $Date$
 */
public class RecordType implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _dataName
     */
    private java.lang.String _dataName;

    /**
     * Field _times
     */
    private int _times;

    /**
     * keeps track of state for field: _times
     */
    private boolean _has_times;

    /**
     * Field _refTimes
     */
    private java.lang.String _refTimes;

    /**
     * Field _xmlTag
     */
    private java.lang.String _xmlTag;

    /**
     * Field _xmlPadding
     */
    private java.lang.String _xmlPadding;

    /**
     * Field _xmlAlign
     */
    private java.lang.String _xmlAlign;

    /**
     * Field _recordLength
     */
    private com.jzhao.jpre.format.sequential.castor.RecordLength _recordLength;

    /**
     * Field _recordElementList
     */
    private java.util.Vector _recordElementList;


      //----------------/
     //- Constructors -/
    //----------------/

    public RecordType() 
     {
        super();
        this._recordElementList = new java.util.Vector();
    } //-- com.jzhao.jpre.format.sequential.castor.RecordType()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * 
     * 
     * @param vRecordElement
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addRecordElement(com.jzhao.jpre.format.sequential.castor.RecordElement vRecordElement)
        throws java.lang.IndexOutOfBoundsException
    {
        this._recordElementList.addElement(vRecordElement);
    } //-- void addRecordElement(com.jzhao.jpre.format.sequential.castor.RecordElement) 

    /**
     * 
     * 
     * @param index
     * @param vRecordElement
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addRecordElement(int index, com.jzhao.jpre.format.sequential.castor.RecordElement vRecordElement)
        throws java.lang.IndexOutOfBoundsException
    {
        this._recordElementList.add(index, vRecordElement);
    } //-- void addRecordElement(int, com.jzhao.jpre.format.sequential.castor.RecordElement) 

    /**
     */
    public void deleteTimes()
    {
        this._has_times= false;
    } //-- void deleteTimes() 

    /**
     * Method enumerateRecordElement
     * 
     * 
     * 
     * @return an Enumeration over all
     * com.jzhao.jpre.format.sequential.castor.RecordElement
     * elements
     */
    public java.util.Enumeration enumerateRecordElement()
    {
        return this._recordElementList.elements();
    } //-- java.util.Enumeration enumerateRecordElement() 

    /**
     * Returns the value of field 'dataName'.
     * 
     * @return the value of field 'DataName'.
     */
    public java.lang.String getDataName()
    {
        return this._dataName;
    } //-- java.lang.String getDataName() 

    /**
     * Method getRecordElement
     * 
     * 
     * 
     * @param index
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     * @return the value of the
     * com.jzhao.jpre.format.sequential.castor.RecordElement at
     * the given index
     */
    public com.jzhao.jpre.format.sequential.castor.RecordElement getRecordElement(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        // check bounds for index
        if (index < 0 || index >= this._recordElementList.size()) {
            throw new IndexOutOfBoundsException("getRecordElement: Index value '" + index + "' not in range [0.." + (this._recordElementList.size() - 1) + "]");
        }
        
        return (com.jzhao.jpre.format.sequential.castor.RecordElement) _recordElementList.get(index);
    } //-- com.jzhao.jpre.format.sequential.castor.RecordElement getRecordElement(int) 

    /**
     * Method getRecordElement
     * 
     * 
     * 
     * @return this collection as an Array
     */
    public com.jzhao.jpre.format.sequential.castor.RecordElement[] getRecordElement()
    {
        int size = this._recordElementList.size();
        com.jzhao.jpre.format.sequential.castor.RecordElement[] array = new com.jzhao.jpre.format.sequential.castor.RecordElement[size];
        for (int index = 0; index < size; index++){
            array[index] = (com.jzhao.jpre.format.sequential.castor.RecordElement) _recordElementList.get(index);
        }
        
        return array;
    } //-- com.jzhao.jpre.format.sequential.castor.RecordElement[] getRecordElement() 

    /**
     * Method getRecordElementCount
     * 
     * 
     * 
     * @return the size of this collection
     */
    public int getRecordElementCount()
    {
        return this._recordElementList.size();
    } //-- int getRecordElementCount() 

    /**
     * Returns the value of field 'recordLength'.
     * 
     * @return the value of field 'RecordLength'.
     */
    public com.jzhao.jpre.format.sequential.castor.RecordLength getRecordLength()
    {
        return this._recordLength;
    } //-- com.jzhao.jpre.format.sequential.castor.RecordLength getRecordLength() 

    /**
     * Returns the value of field 'refTimes'.
     * 
     * @return the value of field 'RefTimes'.
     */
    public java.lang.String getRefTimes()
    {
        return this._refTimes;
    } //-- java.lang.String getRefTimes() 

    /**
     * Returns the value of field 'times'.
     * 
     * @return the value of field 'Times'.
     */
    public int getTimes()
    {
        return this._times;
    } //-- int getTimes() 

    /**
     * Returns the value of field 'xmlAlign'.
     * 
     * @return the value of field 'XmlAlign'.
     */
    public java.lang.String getXmlAlign()
    {
        return this._xmlAlign;
    } //-- java.lang.String getXmlAlign() 

    /**
     * Returns the value of field 'xmlPadding'.
     * 
     * @return the value of field 'XmlPadding'.
     */
    public java.lang.String getXmlPadding()
    {
        return this._xmlPadding;
    } //-- java.lang.String getXmlPadding() 

    /**
     * Returns the value of field 'xmlTag'.
     * 
     * @return the value of field 'XmlTag'.
     */
    public java.lang.String getXmlTag()
    {
        return this._xmlTag;
    } //-- java.lang.String getXmlTag() 

    /**
     * Method hasTimes
     * 
     * 
     * 
     * @return true if at least one Times has been added
     */
    public boolean hasTimes()
    {
        return this._has_times;
    } //-- boolean hasTimes() 

    /**
     * Method isValid
     * 
     * 
     * 
     * @return true if this object is valid according to the schema
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * 
     * 
     * @param handler
     * @throws java.io.IOException if an IOException occurs during
     * marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     */
    public void marshal(org.xml.sax.ContentHandler handler)
        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     */
    public void removeAllRecordElement()
    {
        this._recordElementList.clear();
    } //-- void removeAllRecordElement() 

    /**
     * Method removeRecordElement
     * 
     * 
     * 
     * @param vRecordElement
     * @return true if the object was removed from the collection.
     */
    public boolean removeRecordElement(com.jzhao.jpre.format.sequential.castor.RecordElement vRecordElement)
    {
        boolean removed = _recordElementList.remove(vRecordElement);
        return removed;
    } //-- boolean removeRecordElement(com.jzhao.jpre.format.sequential.castor.RecordElement) 

    /**
     * Method removeRecordElementAt
     * 
     * 
     * 
     * @param index
     * @return the element removed from the collection
     */
    public com.jzhao.jpre.format.sequential.castor.RecordElement removeRecordElementAt(int index)
    {
        Object obj = this._recordElementList.remove(index);
        return (com.jzhao.jpre.format.sequential.castor.RecordElement) obj;
    } //-- com.jzhao.jpre.format.sequential.castor.RecordElement removeRecordElementAt(int) 

    /**
     * Sets the value of field 'dataName'.
     * 
     * @param dataName the value of field 'dataName'.
     */
    public void setDataName(java.lang.String dataName)
    {
        this._dataName = dataName;
    } //-- void setDataName(java.lang.String) 

    /**
     * 
     * 
     * @param index
     * @param vRecordElement
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void setRecordElement(int index, com.jzhao.jpre.format.sequential.castor.RecordElement vRecordElement)
        throws java.lang.IndexOutOfBoundsException
    {
        // check bounds for index
        if (index < 0 || index >= this._recordElementList.size()) {
            throw new IndexOutOfBoundsException("setRecordElement: Index value '" + index + "' not in range [0.." + (this._recordElementList.size() - 1) + "]");
        }
        
        this._recordElementList.set(index, vRecordElement);
    } //-- void setRecordElement(int, com.jzhao.jpre.format.sequential.castor.RecordElement) 

    /**
     * 
     * 
     * @param vRecordElementArray
     */
    public void setRecordElement(com.jzhao.jpre.format.sequential.castor.RecordElement[] vRecordElementArray)
    {
        //-- copy array
        _recordElementList.clear();
        
        for (int i = 0; i < vRecordElementArray.length; i++) {
                this._recordElementList.add(vRecordElementArray[i]);
        }
    } //-- void setRecordElement(com.jzhao.jpre.format.sequential.castor.RecordElement) 

    /**
     * Sets the value of field 'recordLength'.
     * 
     * @param recordLength the value of field 'recordLength'.
     */
    public void setRecordLength(com.jzhao.jpre.format.sequential.castor.RecordLength recordLength)
    {
        this._recordLength = recordLength;
    } //-- void setRecordLength(com.jzhao.jpre.format.sequential.castor.RecordLength) 

    /**
     * Sets the value of field 'refTimes'.
     * 
     * @param refTimes the value of field 'refTimes'.
     */
    public void setRefTimes(java.lang.String refTimes)
    {
        this._refTimes = refTimes;
    } //-- void setRefTimes(java.lang.String) 

    /**
     * Sets the value of field 'times'.
     * 
     * @param times the value of field 'times'.
     */
    public void setTimes(int times)
    {
        this._times = times;
        this._has_times = true;
    } //-- void setTimes(int) 

    /**
     * Sets the value of field 'xmlAlign'.
     * 
     * @param xmlAlign the value of field 'xmlAlign'.
     */
    public void setXmlAlign(java.lang.String xmlAlign)
    {
        this._xmlAlign = xmlAlign;
    } //-- void setXmlAlign(java.lang.String) 

    /**
     * Sets the value of field 'xmlPadding'.
     * 
     * @param xmlPadding the value of field 'xmlPadding'.
     */
    public void setXmlPadding(java.lang.String xmlPadding)
    {
        this._xmlPadding = xmlPadding;
    } //-- void setXmlPadding(java.lang.String) 

    /**
     * Sets the value of field 'xmlTag'.
     * 
     * @param xmlTag the value of field 'xmlTag'.
     */
    public void setXmlTag(java.lang.String xmlTag)
    {
        this._xmlTag = xmlTag;
    } //-- void setXmlTag(java.lang.String) 

    /**
     * Method unmarshal
     * 
     * 
     * 
     * @param reader
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @return the unmarshaled
     * com.jzhao.jpre.format.sequential.castor.RecordType
     */
    public static com.jzhao.jpre.format.sequential.castor.RecordType unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (com.jzhao.jpre.format.sequential.castor.RecordType) Unmarshaller.unmarshal(com.jzhao.jpre.format.sequential.castor.RecordType.class, reader);
    } //-- com.jzhao.jpre.format.sequential.castor.RecordType unmarshal(java.io.Reader) 

    /**
     * 
     * 
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
